"""
内容：将添加会员设计成一个类
作者：赵柚桥
"""
# 引入模块

from ECshop.common.base import Base


# 创建一个会员添加类
class AddMember(Base):
    # 定义属性
    url = 'http://localhost:8080/ecshop/admin/'
    member_management = ('class name', 'icon-members')
    add_button = ('css selector', "a[href='users.php?act=add'")
    frame_name_01 = 'menu-frame'
    frame_name_02 = 'main-frame'
    username = ('name', 'username')
    email = ('name', 'email')
    password = ('name', 'password')
    sure_password = ('name', 'confirm_password')
    button = ('css selector', 'input[value=" 确定 "]')

    # 定义方法
    """获取网页"""

    def page_login_open_web(self):
        self.base_open_web(self.url)

    # 进入frame
    def page_in_frame_01(self):
        self.base_in_frame(self.frame_name_01)

    "点击会员管理"

    def page_click_member_management(self):
        self.base_click(self.member_management)

    # 退出frame
    def page_out_frame(self):
        self.base_quit_frame()

    # 再次进入frame
    def page_in_frame_02(self):
        self.base_in_frame(self.frame_name_02)
    """点击添加会员按钮"""
    def page_click_add_button(self):
        self.base_click(self.add_button)
    """输入会员名"""
    def page_input_username(self, your_username):
        self.base_input_content(self.username, your_username)
    """输入邮件"""
    def page_input_email(self, your_email):
        self.base_input_content(self.email, your_email)
    """输入密码"""
    def page_input_password(self, your_password):
        self.base_input_content(self.password, your_password)
    """确认密码"""
    def page_input_sure_password(self, your_sure_password):
        self.base_input_content(self.sure_password, your_sure_password)
    """点击确定"""
    def page_click_button(self):
        self.base_click(self.button)

    """关闭"""
    def page_quit(self):
        self.base_quit()

# 创建一个登录页面类
class PageLogin(Base):
    # 定义属性
    url1 = 'http://localhost:8080/ecshop/user.php'
    username = ('name', 'username')
    password = ('name', 'password')
    login_button = ('name', 'submit')
    is_success = ('class name', 'f4_b')

    """进入ecshop的登录页面"""

    def page_login_open_web_01(self):
        self.base_open_web(self.url1)

    """输入用户名"""

    def page_login_input_username(self, my_content):
        self.base_input_content(self.username, my_content)

    """输入密码"""

    def page_login_input_password(self, my_content):
        self.base_input_content(self.password, my_content)

    """点击登录按钮"""

    def page_login_button(self):
        self.base_click(self.login_button)

    """///验证"""

    """获取登录后的名字"""

    def page_login_success(self):
        return self.base_get_text(self.is_success)

    """关闭"""

    def page_quit_01(self):
        self.base_quit()


